home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Code Helpe270499272001.psc / Code Helper 2001 / Form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-09-27  |  18.6 KB  |  547 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  3. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  4. Begin VB.Form Form1 
  5.    Caption         =   "Code Helper 2001"
  6.    ClientHeight    =   3705
  7.    ClientLeft      =   60
  8.    ClientTop       =   630
  9.    ClientWidth     =   6600
  10.    Icon            =   "Form1.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3705
  13.    ScaleWidth      =   6600
  14.    StartUpPosition =   2  'CenterScreen
  15.    WhatsThisHelp   =   -1  'True
  16.    Begin MSComctlLib.ImageList ImageList1 
  17.       Left            =   3600
  18.       Top             =   840
  19.       _ExtentX        =   1005
  20.       _ExtentY        =   1005
  21.       BackColor       =   -2147483643
  22.       ImageWidth      =   16
  23.       ImageHeight     =   16
  24.       MaskColor       =   12632256
  25.       _Version        =   393216
  26.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  27.          NumListImages   =   14
  28.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  29.             Picture         =   "Form1.frx":014A
  30.             Key             =   ""
  31.          EndProperty
  32.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  33.             Picture         =   "Form1.frx":02A6
  34.             Key             =   ""
  35.          EndProperty
  36.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  37.             Picture         =   "Form1.frx":0402
  38.             Key             =   ""
  39.          EndProperty
  40.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  41.             Picture         =   "Form1.frx":055E
  42.             Key             =   ""
  43.          EndProperty
  44.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  45.             Picture         =   "Form1.frx":08FA
  46.             Key             =   ""
  47.          EndProperty
  48.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  49.             Picture         =   "Form1.frx":0C96
  50.             Key             =   ""
  51.          EndProperty
  52.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.             Picture         =   "Form1.frx":1032
  54.             Key             =   ""
  55.          EndProperty
  56.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  57.             Picture         =   "Form1.frx":114A
  58.             Key             =   ""
  59.          EndProperty
  60.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  61.             Picture         =   "Form1.frx":1266
  62.             Key             =   ""
  63.          EndProperty
  64.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  65.             Picture         =   "Form1.frx":1382
  66.             Key             =   ""
  67.          EndProperty
  68.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  69.             Picture         =   "Form1.frx":17D6
  70.             Key             =   ""
  71.          EndProperty
  72.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  73.             Picture         =   "Form1.frx":1C2A
  74.             Key             =   ""
  75.          EndProperty
  76.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  77.             Picture         =   "Form1.frx":1D4A
  78.             Key             =   ""
  79.          EndProperty
  80.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  81.             Picture         =   "Form1.frx":1EAE
  82.             Key             =   ""
  83.          EndProperty
  84.       EndProperty
  85.    End
  86.    Begin VB.PictureBox picSep 
  87.       BorderStyle     =   0  'None
  88.       Height          =   3375
  89.       Left            =   2880
  90.       ScaleHeight     =   3375
  91.       ScaleWidth      =   135
  92.       TabIndex        =   4
  93.       TabStop         =   0   'False
  94.       Top             =   960
  95.       Visible         =   0   'False
  96.       Width           =   135
  97.    End
  98.    Begin VB.ListBox List1 
  99.       Height          =   3180
  100.       IntegralHeight  =   0   'False
  101.       ItemData        =   "Form1.frx":200A
  102.       Left            =   0
  103.       List            =   "Form1.frx":200C
  104.       Sorted          =   -1  'True
  105.       TabIndex        =   3
  106.       Top             =   960
  107.       Width           =   2415
  108.    End
  109.    Begin VB.PictureBox Picture1 
  110.       Align           =   1  'Align Top
  111.       BackColor       =   &H00808080&
  112.       BorderStyle     =   0  'None
  113.       Height          =   375
  114.       Left            =   0
  115.       ScaleHeight     =   375
  116.       ScaleWidth      =   6600
  117.       TabIndex        =   1
  118.       TabStop         =   0   'False
  119.       Top             =   570
  120.       Width           =   6600
  121.       Begin VB.Label lblTitle 
  122.          BackStyle       =   0  'Transparent
  123.          BeginProperty Font 
  124.             Name            =   "News Gothic MT"
  125.             Size            =   12
  126.             Charset         =   0
  127.             Weight          =   700
  128.             Underline       =   0   'False
  129.             Italic          =   0   'False
  130.             Strikethrough   =   0   'False
  131.          EndProperty
  132.          ForeColor       =   &H00FFFFFF&
  133.          Height          =   315
  134.          Left            =   120
  135.          TabIndex        =   2
  136.          Top             =   45
  137.          Width           =   6015
  138.       End
  139.    End
  140.    Begin MSComctlLib.Toolbar Toolbar1 
  141.       Align           =   1  'Align Top
  142.       Height          =   570
  143.       Left            =   0
  144.       TabIndex        =   0
  145.       Top             =   0
  146.       Width           =   6600
  147.       _ExtentX        =   11642
  148.       _ExtentY        =   1005
  149.       ButtonWidth     =   1323
  150.       ButtonHeight    =   953
  151.       Appearance      =   1
  152.       Style           =   1
  153.       ImageList       =   "ImageList1"
  154.       _Version        =   393216
  155.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  156.          NumButtons      =   10
  157.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  158.             Caption         =   "Select all"
  159.             Key             =   "Select"
  160.             Object.ToolTipText     =   "Highlight/Select All Text"
  161.             ImageIndex      =   4
  162.          EndProperty
  163.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  164.             Caption         =   "Copy"
  165.             Key             =   "Copy"
  166.             Object.ToolTipText     =   "Copy Highlighted/Selected Text"
  167.             ImageIndex      =   6
  168.          EndProperty
  169.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  170.             Caption         =   "Copy all"
  171.             Key             =   "Copy all"
  172.             Object.ToolTipText     =   "Copy All Text"
  173.             ImageIndex      =   6
  174.          EndProperty
  175.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  176.             Style           =   3
  177.          EndProperty
  178.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  179.             Caption         =   "Search"
  180.             Key             =   "Search"
  181.             Object.ToolTipText     =   "Search For Keyword"
  182.             ImageIndex      =   8
  183.          EndProperty
  184.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  185.             Style           =   3
  186.          EndProperty
  187.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  188.             Enabled         =   0   'False
  189.             Caption         =   "Info"
  190.             Key             =   "Info"
  191.             Object.ToolTipText     =   "Code Information"
  192.             ImageIndex      =   11
  193.          EndProperty
  194.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  195.             Enabled         =   0   'False
  196.             Caption         =   "Pic"
  197.             Key             =   "Pic"
  198.             Object.ToolTipText     =   "Code Picture"
  199.             ImageIndex      =   13
  200.          EndProperty
  201.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  202.             Style           =   3
  203.          EndProperty
  204.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  205.             Caption         =   "Color"
  206.             Key             =   "Color"
  207.             Object.ToolTipText     =   "Syntax Coloring"
  208.             ImageIndex      =   14
  209.             Style           =   1
  210.          EndProperty
  211.       EndProperty
  212.    End
  213.    Begin RichTextLib.RichTextBox Text1 
  214.       Height          =   2655
  215.       Left            =   2520
  216.       TabIndex        =   5
  217.       Top             =   960
  218.       Width           =   3855
  219.       _ExtentX        =   6800
  220.       _ExtentY        =   4683
  221.       _Version        =   393217
  222.       BackColor       =   -2147483639
  223.       HideSelection   =   0   'False
  224.       ReadOnly        =   -1  'True
  225.       ScrollBars      =   3
  226.       DisableNoScroll =   -1  'True
  227.       RightMargin     =   64000
  228.       AutoVerbMenu    =   -1  'True
  229.       TextRTF         =   $"Form1.frx":200E
  230.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  231.          Name            =   "Courier New"
  232.          Size            =   9.75
  233.          Charset         =   0
  234.          Weight          =   400
  235.          Underline       =   0   'False
  236.          Italic          =   0   'False
  237.          Strikethrough   =   0   'False
  238.       EndProperty
  239.    End
  240.    Begin VB.Image ImgSep 
  241.       Height          =   3255
  242.       Left            =   2400
  243.       MousePointer    =   9  'Size W E
  244.       Top             =   960
  245.       Width           =   135
  246.    End
  247.    Begin VB.Menu mnuFile 
  248.       Caption         =   "&File"
  249.       Begin VB.Menu mnuExit 
  250.          Caption         =   "E&xit"
  251.       End
  252.    End
  253.    Begin VB.Menu mnuEdit 
  254.       Caption         =   "&Edit"
  255.       Begin VB.Menu mnuCut 
  256.          Caption         =   "Cu&t"
  257.          Shortcut        =   ^X
  258.          Visible         =   0   'False
  259.       End
  260.       Begin VB.Menu mnuCopy 
  261.          Caption         =   "&Copy"
  262.          Shortcut        =   ^C
  263.       End
  264.       Begin VB.Menu mnuCopyall 
  265.          Caption         =   "Copy all"
  266.          Shortcut        =   ^S
  267.       End
  268.       Begin VB.Menu mnuPaste 
  269.          Caption         =   "&Paste"
  270.          Shortcut        =   ^V
  271.          Visible         =   0   'False
  272.       End
  273.       Begin VB.Menu mnuDelete 
  274.          Caption         =   "&Delete"
  275.          Shortcut        =   ^D
  276.          Visible         =   0   'False
  277.       End
  278.       Begin VB.Menu Bar1 
  279.          Caption         =   "-"
  280.       End
  281.       Begin VB.Menu mnuSelect 
  282.          Caption         =   "&Select all"
  283.          Shortcut        =   ^A
  284.       End
  285.       Begin VB.Menu Bar2 
  286.          Caption         =   "-"
  287.       End
  288.       Begin VB.Menu mnuSearch 
  289.          Caption         =   "Search"
  290.          Shortcut        =   {F3}
  291.       End
  292.    End
  293.    Begin VB.Menu mnuView 
  294.       Caption         =   "&View"
  295.       Begin VB.Menu mnuInfo 
  296.          Caption         =   "&Information"
  297.          Shortcut        =   {F4}
  298.       End
  299.       Begin VB.Menu mnuViewPic 
  300.          Caption         =   "&Picture"
  301.          Shortcut        =   {F5}
  302.       End
  303.       Begin VB.Menu Bar4 
  304.          Caption         =   "-"
  305.       End
  306.       Begin VB.Menu mnuSynCol 
  307.          Caption         =   "&Syntax Coloring"
  308.          Shortcut        =   {F8}
  309.       End
  310.    End
  311.    Begin VB.Menu mnuHelp 
  312.       Caption         =   "&Help"
  313.       Begin VB.Menu mnuAbout 
  314.          Caption         =   "&About"
  315.       End
  316.       Begin VB.Menu Bar3 
  317.          Caption         =   "-"
  318.          Visible         =   0   'False
  319.       End
  320.       Begin VB.Menu mnuHelpHelp 
  321.          Caption         =   "&Help"
  322.          Shortcut        =   {F1}
  323.          Visible         =   0   'False
  324.       End
  325.    End
  326. Attribute VB_Name = "Form1"
  327. Attribute VB_GlobalNameSpace = False
  328. Attribute VB_Creatable = False
  329. Attribute VB_PredeclaredId = True
  330. Attribute VB_Exposed = False
  331. Private CurX As Single, CurY As Single
  332. Private Const MinWidth = 6720
  333. Private Const MinHeight = 4110
  334. Private Loading As Boolean
  335. Private Sub Form_Load()
  336. On Local Error GoTo XS
  337. Dim Num As Integer, WinState As Integer
  338. Loading = True
  339. WinState = GetSetting("CH2001", "Main", "WinState", vbNormal)
  340.     Me.Left = GetSetting("CH2001", "Main", "Left", 1000)
  341.     Me.Top = GetSetting("CH2001", "Main", "Top", 1000)
  342.     Me.Width = GetSetting("CH2001", "Main", "Width", MinWidth)
  343.     Me.Height = GetSetting("CH2001", "Main", "Height", MinHeight)
  344. If WinState = vbMaximized + 1 Then
  345.     Me.WindowState = WinState - 1
  346. End If
  347. List1.Width = GetSetting("CH2001", "Main", "SepWid", 2000)
  348. Loading = False
  349. Form_Resize
  350. List1.Clear
  351. SetInfo
  352. DoEvents
  353. SetScriptKeywords
  354. OpenFile
  355. DoEvents
  356. For Num = 0 To UBound(MyCode)
  357.     List1.AddItem MyCode(Num).EntryName
  358. Next Num
  359. If List1.ListCount > 0 Then List1.ListIndex = 0
  360. End Sub
  361. Private Sub Form_Resize()
  362. If Loading = True Then Exit Sub
  363. If Me.WindowState <> vbMinimized Then
  364.     If Me.Width < MinWidth Then Me.Width = MinWidth
  365.     If Me.Height < MinHeight Then Me.Height = MinHeight
  366.     List1.Move 0, Picture1.Top + Picture1.Height + 40, List1.Width, ScaleHeight - (Picture1.Top + Picture1.Height + 40)
  367.     Text1.Move List1.Left + List1.Width + 40, List1.Top, ScaleWidth - (List1.Left + List1.Width + 40), List1.Height
  368.     ImgSep.Left = List1.Left + List1.Width
  369.     ImgSep.Height = ScaleHeight - ImgSep.Top
  370. End If
  371. End Sub
  372. Private Sub Form_Unload(Cancel As Integer)
  373. If Me.WindowState <> vbMaximized Then
  374.     SaveSetting "CH2001", "Main", "Left", Me.Left
  375.     SaveSetting "CH2001", "Main", "Top", Me.Top
  376.     SaveSetting "CH2001", "Main", "Width", Me.Width
  377.     SaveSetting "CH2001", "Main", "Height", Me.Height
  378.     SaveSetting "CH2001", "Main", "SepWid", ImgSep.Left
  379. End If
  380. SaveSetting "CH2001", "Main", "WinState", Me.WindowState + 1
  381. End Sub
  382. Private Sub ImgSep_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  383. If Button = 1 Then
  384.     CurX = x: CurY = y
  385.     picSep.Left = ImgSep.Left
  386.     picSep.Height = ImgSep.Height
  387.     picSep.Width = 40
  388.     picSep.Visible = True
  389. End If
  390. End Sub
  391. Private Sub ImgSep_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  392. Dim L As Single
  393. If Button = 1 Then
  394.     L = ImgSep.Left + x - CurX
  395.     If L > 1000 And L < (ScaleWidth - 2000) Then
  396.         picSep.Left = L
  397.     End If
  398. End If
  399. End Sub
  400. Private Sub ImgSep_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  401. If Button = 1 Then
  402.     picSep.Visible = False
  403.     List1.Width = (picSep.Left - List1.Left)
  404.     Form_Resize
  405. End If
  406. End Sub
  407. Private Sub List1_Click()
  408. lblTitle.Caption = List1.List(List1.ListIndex)
  409. Text1.Text = MyCode(GetIndex(List1.Text)).EntryValue
  410. If Text1.Text = "" Then
  411.     Toolbar1.Buttons(2).Enabled = False
  412.     Toolbar1.Buttons(3).Enabled = False
  413.     Toolbar1.Buttons(1).Enabled = False
  414.     Me.mnuCopy.Enabled = False
  415.     Me.mnuCopyall.Enabled = False
  416.     Me.mnuSelect.Enabled = False
  417.     Toolbar1.Buttons(2).Enabled = True
  418.     Toolbar1.Buttons(3).Enabled = True
  419.     Toolbar1.Buttons(1).Enabled = True
  420.     Me.mnuCopy.Enabled = True
  421.     Me.mnuCopyall.Enabled = True
  422.     Me.mnuSelect.Enabled = True
  423. End If
  424. If MyCode(GetIndex(List1.Text)).EntryInfo = "" Then
  425.     Toolbar1.Buttons(7).Enabled = False
  426.     mnuInfo.Enabled = False
  427.     Toolbar1.Buttons(7).Enabled = True
  428.     mnuInfo.Enabled = True
  429. End If
  430. If MyCode(GetIndex(List1.Text)).EntryPicName = "" Or Dir(Apath & "Pictures\" & MyCode(GetIndex(List1.Text)).EntryPicName) = "" Then
  431.     Toolbar1.Buttons(8).Enabled = False
  432.     mnuViewPic.Enabled = False
  433.     Toolbar1.Buttons(8).Enabled = True
  434.     mnuViewPic.Enabled = True
  435. End If
  436. If Text1.Text <> "" And Toolbar1.Buttons(10).Value = tbrPressed Then
  437.     ColorBox Text1
  438. End If
  439. End Sub
  440. Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
  441. Dim maxlen As Single, tmp As Single, i As Integer
  442. If KeyCode = vbKeySpace Then
  443.     If List1.ListCount > 0 Then
  444.         For i = 0 To List1.ListCount - 1
  445.             tmp = Me.TextWidth(List1.List(i))
  446.             If tmp > maxlen Then maxlen = tmp
  447.             tmp = 0
  448.         Next i
  449.     End If
  450.     List1.Width = maxlen + 160
  451.     Form_Resize
  452.     KeyCode = 0
  453. End If
  454. End Sub
  455. Private Sub mnuAbout_Click()
  456. frmAbout.Show 1
  457. End Sub
  458. Private Sub mnuCopy_Click()
  459. If Text1.SelText <> "" Then
  460.     Clipboard.Clear
  461.     Clipboard.SetText Text1.SelText
  462. End If
  463. End Sub
  464. Private Sub mnuCopyall_Click()
  465. If Text1.Text <> "" Then
  466.     Clipboard.Clear
  467.     Clipboard.SetText Text1.Text
  468. End If
  469. End Sub
  470. Private Sub mnuCut_Click()
  471. If Text1.SelText <> "" Then
  472.     Clipboard.Clear
  473.     Clipboard.SetText Text1.SelText
  474.     Text1.SelText = ""
  475. End If
  476. End Sub
  477. Private Sub mnuDelete_Click()
  478. Text1.SelText = ""
  479. End Sub
  480. Private Sub mnuExit_Click()
  481. Unload Me
  482. End Sub
  483. Private Sub mnuInfo_Click()
  484. If MyCode(GetIndex(List1.Text)).EntryInfo = "" Then Exit Sub
  485. Dim FM As frmView
  486. Set FM = frmView
  487. InfoBox = True
  488. Load FM
  489. FM.Caption = "Information"
  490. FM.Text1.BackColor = vbButtonFace '&HC0FFFF
  491. 'FM.Text1.ForeColor = &HC00000
  492. FM.Text1.Font.Size = 10
  493. FM.Text1.Font.Name = "Courier New"
  494. FM.Text1.Text = MyCode(GetIndex(List1.Text)).EntryInfo
  495. FM.Show , Me
  496. End Sub
  497. Private Sub mnuPaste_Click()
  498. If Clipboard.GetText <> "" Then
  499.     Text1.SelText = Clipboard.GetText
  500. End If
  501. End Sub
  502. Private Sub mnuSearch_Click()
  503. frmSearch.Show , Me
  504. End Sub
  505. Private Sub mnuSelect_Click()
  506. Text1.SelStart = 0
  507. Text1.SelLength = Len(Text1.Text)
  508. Text1.SetFocus
  509. End Sub
  510. Private Sub mnuSynCol_Click()
  511. If mnuSynCol.Checked = True Then
  512.     Me.Text1.SelStart = 0
  513.     Me.Text1.SelLength = Len(Me.Text1.Text)
  514.     Me.Text1.SelColor = vbBlack
  515.     Me.Text1.SelLength = 0
  516.     mnuSynCol.Checked = False
  517.     Toolbar1.Buttons(10).Value = tbrUnpressed
  518.     mnuSynCol.Checked = True
  519.     Toolbar1.Buttons(10).Value = tbrPressed
  520.     ColorBox Me.Text1
  521. End If
  522. End Sub
  523. Private Sub mnuViewPic_Click()
  524. On Error GoTo XS
  525. If Dir(Apath & "Pictures\" & MyCode(GetIndex(List1.Text)).EntryPicName) <> "" Then
  526.     Load frmPic
  527.     'frmPic.PaintPicture LoadPicture(Apath & "Pictures\" & MyCode(List1.ListIndex).EntryPicName), 0, 0
  528.     frmPic.Picture1.Picture = LoadPicture(Apath & "Pictures\" & MyCode(GetIndex(List1.Text)).EntryPicName)
  529.     frmPic.Width = frmPic.Picture1.Width + (frmPic.Width - frmPic.ScaleWidth)
  530.     frmPic.Height = frmPic.Picture1.Height + (frmPic.Height - frmPic.ScaleHeight)
  531.     frmPic.Show , Me
  532. End If
  533. End Sub
  534. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  535. Select Case Button.Key
  536.     Case "Select":   mnuSelect_Click
  537.     Case "Cut":      mnuCut_Click
  538.     Case "Copy":     mnuCopy_Click
  539.     Case "Copyall":  mnuCopyall_Click
  540.     Case "Paste":    mnuPaste_Click
  541.     Case "Search":   mnuSearch_Click
  542.     Case "Info":     mnuInfo_Click
  543.     Case "Pic":      mnuViewPic_Click
  544.     Case "Color":    mnuSynCol_Click
  545. End Select
  546. End Sub
  547.